<script>
export default {
  watch: {
    '$route': {
      handler(val) {
        var permission_routes_visible = this.$store.getters.permission_routes.filter((item) => !item.hidden && item.parentId === '0')
        if (val.path === '/redirect') {
          if (permission_routes_visible.length > 0) {
            this.$store.dispatch('tagsView/addView', permission_routes_visible[0].redirectId)
            this.$router.push({ path: permission_routes_visible[0].redirect })
          }
        }
      },
      deep: true,
      immediate: true
    }
  },
  render: function(h) {
    return h() // avoid warning message
  }
}
</script>
